<?php

/* @var $this yii\web\View */
/* @var $name string */
/* @var $message string */
/* @var $exception Exception */

use yii\helpers\Html;

$this->title = '操作提示';
?>
<div class="site-error">

    <h1><?= Html::encode($this->title) ?></h1>

    <div class="alert alert-danger">
        <?= nl2br(Html::encode($message)) ?>
        <div>
            <a href="/">点击这里跳转</a>&nbsp;&nbsp;
            或 <b id="tips-cut-time" style="font-size: 18px;">3</b> 秒后系统自动跳转
        </div>
    </div>

    <p>
        The above error occurred while the Web server was processing your request.
    </p>
    <p>
        Please contact us if you think this is a server error. Thank you.
    </p>

</div>

<?php
$script = <<<JS
    var url = "/";
    var t;
    function delayURL() {
        var delay = document.getElementById("tips-cut-time").innerHTML;
        if(delay > 0){
            delay--;
            document.getElementById("tips-cut-time").innerHTML = delay;
		    t = setTimeout(delayURL, 1000);
        } else {
	        clearTimeout(t);
            window.location.href = url;
        }
    }
    delayURL();
JS;
$this->registerJs($script);
?>